package 笔试.A百度;

import java.util.Scanner;

public class second {

    public static void main(String arg[]){//main--来自高金磊

         Scanner scanner=new Scanner(System.in);
         int T=scanner.nextInt();
        for (int i = 0; i < T; i++) {
            int N=scanner.nextInt();
            int small=1;
            int count=0;
            while (small<N/small){
                if (N%small==0){
                    if (getGreatestCommonDivisor4(small,N/small)==1){
                        count++;
//                        System.out.println(small);
                    }
                }
                small++;
            }
            System.out.println(count);
        }
    }
    public static int getGreatestCommonDivisor4(int a, int b) {
        if (a == b) {
            return a;
        }
        if ((a & 1) == 0 && (b & 1) == 0) {// a,b都是偶数
            return 2;
        } else if ((a & 1) == 0 && (b & 1) != 0) {// a为偶数，b为奇数
            return getGreatestCommonDivisor4(a >> 1, b);
        } else if ((a & 1) != 0 && (b & 1) == 0) {// a为奇数，b为偶数
            return getGreatestCommonDivisor4(a, b >> 1);
        } else {// a,b都是奇数
            int big = Math.max(a, b);
            int small = Math.min(a, b);
            return getGreatestCommonDivisor4(big - small, small);
        }
    }
}
